<!DOCTYPE html>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/12/6
  Time: 22:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

    <title>物联网净水系统管理</title>
    <meta name="keywords" content="ZHAO ME 系统管理">
    <meta name="description" content="ZHAO ME 系统管理">
    <link href="${pageContext.request.contextPath}/static/css/bootstrap.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/css/animate.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/css/style.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/css/login.css" rel="stylesheet">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html"/>
    <![endif]-->
    <script>
        if (window.top !== window.self) {
            window.top.location = window.location;
        }
    </script>
    <c:import url="/WEB-INF/page/header.jsp"/>
</head>

<body class="signin">
<div class="signinpanel">
    <div class="row">
        <div class="col-sm-3">
        </div>
        <div class="col-sm-6">
            <form id="loginForm" method="post">
                <h4 class="no-margins">登录：</h4>
                <input name="loginName" type="text" value="" class="form-control uname" placeholder="用户名"/>
                <input name="password" type="password" value="" class="form-control pword m-b" placeholder="密码"/>
                <a href="">忘记密码了？</a>
            </form>
            <button class="btn btn-success btn-block" onclick="doLogin()">登录</button>
        </div>
        <div class="col-sm-3">
        </div>
    </div>
    <div class="signup-footer">
        <div class="pull-left">
            &copy; 2018 All Rights Reserved.
        </div>
    </div>
</div>
<c:import url="/WEB-INF/page/footer.jsp"/>
<script type="text/javascript">
    function doLogin() {
        $.ajax({
            url: base + "/do_login",
            type: "post",
            data: $("#loginForm").serialize(),
            dataType: "json",
            success: function (data) {
                console.info(data);
                if (data.code == 0) {
                    swal("登录成功！", "", "success");
                    window.location.href = base + "/";
                } else {
                    swal("登录失败！", data.msg, "error");
                }
            },
            error: function (data) {
                swal("登录失败！", "系统错误", "error");
            }
        });
    }
</script>
</body>

</html>
